#!/usr/bin/perl

$message = <STDIN>;

@a = ();
@b = (ord("`")..ord("{"),
      ord("/"),
      ord("\""),
      ord(" "),
      ord("-")
     );

push @a, (ord(" ")..ord("/"));
push @a, (ord(":")..ord("@"));
push @a, (ord("[")..ord("`"));
push @a, (ord("{")..ord("}"));

$dictionary = ' -/:-@[-`{-}';

#for ($i = 0; $i < @a; $i ++) {
#  print chr($a[$i]) .
#        " => " .
#        chr($b[$i]) .
#        "\n";
#}

# encrypt the message
$message = 'print "' . $message . '"';
$enc = "";

for ($i = 0; $i < length($message); $i++ ) {
  $tb = substr($message, $i, 1);
  for ($j = 0; $j < @a; $j++) {
    if ($tb eq chr($b[$j])) {
      if ( $tb eq "d" ) {
	$enc .= '\$';
      }
      else {
	$enc .= chr($a[$j]);
      }
      break;
    }
  }
}

# generate final perl source file
print '#!/usr/bin/env perl' . "\n";
print '$??s:;s:s;;$?::s;;' . $enc . ';;y;' . $dictionary . ';`-{/" -;;s;;$_;see;' . "\n";

